package com.homework.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.homework.service.EditorService;
import com.opensymphony.xwork2.ActionSupport;

public class EditorGetAction extends ActionSupport implements ServletRequestAware{
	/**
	 * 
	 */
	private static final long serialVersionUID = -3531122927291260237L;
	HttpServletRequest request = null;
	private EditorService editorService;
	public Map<String, String> map = new HashMap<String, String>();

	public EditorGetAction()
	{
		editorService = new EditorService();
	}



	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		request = arg0;
	}



	public String execute() {
		//		String jsonofTitle = request.getParameter("request");
		//		
		//		JSONObject json = new JSONObject();
		//		
		String homeworkId = request.getParameter("homeworkId");
		
		String homework = editorService.getHomework(homeworkId);
		map.put("result", homework);
		return "success";
	}
}
